import request from '@/config/axios'

/** 用户信息拓展信息 */
export interface UserExtend {
          id: number; // ID
          userId?: number; // 用户ID
          balance?: number; // 账户余额
  }

// 用户信息拓展 API
export const UserExtendApi = {
  // 查询用户信息拓展分页
  getUserExtendPage: async (params: any) => {
    return await request.get({ url: `/business/user-extend/page`, params })
  },

  // 查询用户信息拓展详情
  refreshBalance: async () => {
    return await request.get({ url: `/business/user-extend/refresh/balance` })
  },

  // 查询用户信息拓展详情
  getUserExtend: async (id: number) => {
    return await request.get({ url: `/business/user-extend/get?id=` + id })
  },

  // 更新用户余额
  updateUserBalance: async (data: UserExtend) => {
    return await request.post({ url: `/business/user-extend/update/balance`, data })
  },

  // 获取用户二维码
  getQrCode: async () => {
    return await request.get({ url: `/business/user-extend/get/qrcode` })
  },

  // 刷新用户二维码
  refreshQrCode: async () => {
    return await request.get({ url: `/business/user-extend/refresh/qrcode` })
  },

  // 删除用户信息拓展
  deleteUserExtend: async (id: number) => {
    return await request.delete({ url: `/business/user-extend/delete?id=` + id })
  },

  /** 批量删除用户信息拓展 */
  deleteUserExtendList: async (ids: number[]) => {
    return await request.delete({ url: `/business/user-extend/delete-list?ids=${ids.join(',')}` })
  },

  // 导出用户信息拓展 Excel
  exportUserExtend: async (params) => {
    return await request.download({ url: `/business/user-extend/export-excel`, params })
  },
}
